package com.keepsport.keepsportapi.controller;

import com.keepsport.keepsportapi.config.SystemConfig;
import com.keepsport.keepsportapi.service.intf.CommunityTopicService;
import com.keepsport.keepsportapi.vo.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

/***
 *         O
 *      _ooOoo_
 *     o8888888o
 *     88" . "88
 *     (| -_- |)
 *      O\ = /O
 *  ____/`---'\____
 *  ...............
 *  佛祖保佑  永无BUG
 *   Data:2022/7/1
 *   Author:King
 *   Description:
 */
@RestController
@RequestMapping("api/topic")
@Api
@CrossOrigin
public class CommunityTopicController {
    @Resource
    private CommunityTopicService service;

    @GetMapping("select.do")
    @ApiOperation(value = "按热度查看")
    public R findDesc(){
        return service.findDesc();
    }

    @GetMapping("selectOne.do")
    @ApiOperation(value = "按热度查看")
    public R findDesc(int id){
        return service.findOne(id);
    }

    @GetMapping("update.do")
    @ApiOperation(value = "修改热度")
    public R updateHeat(HttpServletRequest request,int tid ){
        return service.updateHeat(request.getIntHeader(SystemConfig.TOKEN_HEADER),tid);
    }
}
